home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / prtrep51.zip / REPSRC.ZIP / UNITMAIN.PAS < prev   
Pascal/Delphi Source File  |  1996-06-24  |  5KB  |  166 lines

  1. unit Unitmain;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  6.   StdCtrls, ExtCtrls, Dialogs, PrnFile, CB_Types, RepDem01,
  7.   RepDem02, RepDem03, RepDem04, RepDem05, RepDem06, RepDem07;
  8.  
  9. type
  10.   TMainDialog = class(TForm)
  11.     Label1: TLabel;
  12.     Panel1: TPanel;
  13.     Bevel1: TBevel;
  14.     ListBox1: TListBox;
  15.     View: TButton;
  16.     Exit: TButton;
  17.     Printer: TButton;
  18.     PrinterSetupDialog1: TPrinterSetupDialog;
  19.     Printit: TLabel;
  20.     Label2: TLabel;
  21.     Label3: TLabel;
  22.     OpenDialog1: TOpenDialog;
  23.     PrintFile1: TPrintFile;
  24.     procedure ExitClick(Sender: TObject);
  25.     procedure ViewClick(Sender: TObject);
  26.     procedure PrinterClick(Sender: TObject);
  27.     procedure ListBox1DblClick(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.   end;
  33.  
  34. var
  35.   MainDialog: TMainDialog;
  36.  
  37. implementation
  38.  
  39. {$R *.DFM}
  40.  
  41. procedure TMainDialog.ExitClick(Sender: TObject);
  42. begin
  43.     Close;
  44. end;
  45.  
  46. procedure TMainDialog.ViewClick(Sender: TObject);
  47. var
  48.     OpenDialog1: TOpenDialog;
  49.  
  50. begin
  51.     if ListBox1.ItemIndex < 0 then
  52.     MessageDlg('Please select an option from the List Box', mtInformation,
  53.       [mbOk], 0);
  54.  
  55.     if (ListBox1.ItemIndex >= 0) then begin
  56.        case ListBox1.ItemIndex of
  57.        0: begin
  58.            dem01form := Tdem01form.Create (Application);
  59.           dem01form.ShowModal;
  60.           dem01form.Free;
  61.           end;
  62.        1: begin
  63.            dem02form := Tdem02form.Create (Application);
  64.           dem02form.ShowModal;
  65.           dem02form.Free;
  66.           end;
  67.        2: begin
  68.            dem03form := Tdem03form.Create (Application);
  69.           dem03form.ShowModal;
  70.           dem03form.Free;
  71.           end;
  72.        3: begin
  73.            dem04form := Tdem04form.Create (Application);
  74.           dem04form.ShowModal;
  75.           dem04form.Free;
  76.          end;
  77.        4: begin
  78.            dem05form := Tdem05form.Create (Application);
  79.           dem05form.ShowModal;
  80.           dem05form.Free;
  81.           end;
  82.        5: begin
  83.            dem06form := Tdem06form.Create (Application);
  84.           dem06form.ShowModal;
  85.           dem06form.Free;
  86.           end;
  87.        6: begin
  88.            dem07form := Tdem07form.Create (Application);
  89.           dem07form.ShowModal;
  90.           dem07form.Free;
  91.           end;
  92.        7: begin
  93.                 OpenDialog1 := TOpenDialog.Create(Application);
  94.                 OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
  95.                     '|*.PAS|Quattro Pro files (*.WB1)|*.WB1|All Files (*.*)|*.*';
  96.  
  97.                 OpenDialog1.FileName := '';
  98.                 if OpenDialog1.Execute then begin
  99.                     PrintFile1.Filename := OpenDialog1.FileName;
  100.                     PrintFile1.PageLayout := pl_1x2;
  101.                     PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
  102.                     PrintFile1.Execute;
  103.                 end;
  104.                 OpenDialog1.Free;
  105.           end;
  106.        8: begin
  107.                  OpenDialog1 := TOpenDialog.Create(Application);
  108.                  OpenDialog1.Filter := 'Text files (*.TXT)|*.TXT|Pascal files (*.PAS)' +
  109.                     '|*.PAS|Quattro Pro files (*.WB1)|*.WB1|All Files (*.*)|*.*';
  110.  
  111.                  OpenDialog1.FileName := '';
  112.                  if OpenDialog1.Execute then begin
  113.                      PrintFile1.Filename := OpenDialog1.FileName;
  114.                     PrintFile1.PageLayout := pl_1x3;
  115.                   PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
  116.                     PrintFile1.Execute;
  117.                  end;
  118.                  OpenDialog1.Free;
  119.           end;
  120.        9: begin
  121.                 PrintFile1.Input := frHTML;
  122.                 OpenDialog1 := TOpenDialog.Create(Application);
  123.                 OpenDialog1.Filter := 'HTML files (*.HTM)|*.HTM';
  124.  
  125.                 OpenDialog1.FileName := '';
  126.                 if OpenDialog1.Execute then begin
  127.                     PrintFile1.Filename := OpenDialog1.FileName;
  128.                     PrintFile1.PageLayout := pl_1x2;
  129.                     PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
  130.                     PrintFile1.Execute;
  131.                 end;
  132.                 OpenDialog1.Free;
  133.                 PrintFile1.Input := frFile;
  134.           end;
  135.        10: begin
  136.               PrintFile1.Input := frHTML;
  137.                 OpenDialog1 := TOpenDialog.Create(Application);
  138.                 OpenDialog1.Filter := 'HTML files (*.HTM)|*.HTM';
  139.  
  140.                 OpenDialog1.FileName := '';
  141.                 if OpenDialog1.Execute then begin
  142.                     PrintFile1.Filename := OpenDialog1.FileName;
  143.                     PrintFile1.PageLayout := pl_1x3;
  144.                     PrintFile1.HeaderStringCenter := OpenDialog1.FileName;
  145.                     PrintFile1.Execute;
  146.                 end;
  147.               PrintFile1.Input := frFile;
  148.                 OpenDialog1.Free;
  149.           end;
  150.  
  151.        end;
  152.    end;
  153. end;
  154.  
  155. procedure TMainDialog.PrinterClick(Sender: TObject);
  156. begin
  157.     PrinterSetupDialog1.Execute;
  158. end;
  159.  
  160. procedure TMainDialog.ListBox1DblClick(Sender: TObject);
  161. begin
  162.     ViewClick(Sender);
  163. end;
  164.  
  165. end.
  166.